import Vue from 'vue'
import VueRouter from 'vue-router'
import Layout from '@/views/Layout/layout'
import Composition from '@/views/Composition/composition'
Vue.use(VueRouter)

// 针对ElementUI导航栏中重复导航报错问题
const originalPush = VueRouter.prototype.push
VueRouter.prototype.push = function push(location) {
    return originalPush.call(this, location).catch(err => err)
}

const routes = [{
        path: '/',
        component: Layout,
        redirect: "/home",
        children: [{
                path: '/home',
                component: () =>
                    import ('@/views/Home/home'),
                meta: { title: '首页' }
            },
            {
                path: '/recommend',
                component: () =>
                    import ('@/views/Recommend/recommend'),
                meta: { title: '推荐' }
            },
            {
                path: '/attention',
                component: () =>
                    import ('@/views/Attention/attention'),
                meta: { title: '关注' }
            },
            {
                path: '/friend',
                component: () =>
                    import ('@/views/Friend/friend'),
                meta: { title: '朋友' }
            },
            {
                path: '/user',
                component: () =>
                    import ('@/views/User/user'),
                meta: {
                    title: '我的'
                }

            },
            {
                path: '/hot',
                component: () =>
                    import ('@/views/Hot/hot'),
                meta: { title: '热点' }
            },
            {
                path: '/type',
                component: () =>
                    import ('@/views/Type/type'),
                meta: { title: '娱乐' }
            },
            // {
            //     path: '/searchDetail',
            //     component: () =>
            //         import ('@/views/SearchDetail/searchDetail'),
            //     meta: {
            //         title: '搜索详情'
            //     }
            // }
            {
                path: '/searchDetail',
                component: () =>
                    import ('@/views/SearchDetail/searchDetail'),
                meta: {
                    title: '搜索详情'
                }
            },

        ]
    },
    {
        path: '/serve',
        component: Composition,
        redirect: "/serviceHome",
        children: [{
                path: '/serviceHome',
                component: () =>
                    import ('@/views/serviceHome/serviceHome'),
                meta: { title: '首页' }
            },
            {
                path: '/videos',
                component: () =>
                    import ('@/views/Videos/videos'),
                meta: { title: '发布视频' }
            },
            {
                path: '/workManagement',
                component: () =>
                    import ('@/views/workManagement/workManagement'),
                meta: { title: '作品管理' }
            },
            {
                path: '/order',
                component: () =>
                    import ('@/views/Order/order'),
                meta: { title: '订单管理' }
            },
            {
                path: '/concernManagement',
                component: () =>
                    import ('@/views/concernManagement/concernManagement'),
                meta: { title: '关注管理' }
            },
            {
                path: '/commentManagement',
                component: () =>
                    import ('@/views/commentManagement/commentManagement'),
                meta: {
                    title: '评论管理'
                }
            },
            {
                path: '/fansManagement',
                component: () =>
                    import ('@/views/fansManagement/fansManagement'),
                meta: {
                    title: '粉丝管理'
                }
            },
            {
                path: '/messageManagement',
                component: () =>
                    import ('@/views/messageManagement/messageManagement'),
                meta: {
                    title: '私信管理'
                }
            }, {
                path: '/detailMessage',
                component: () =>
                    import ('@/views/detailMessage/detailMessage'),
                meta: {
                    title: '详细信息'
                }
            }, {
                path: '/dataScreening',
                component: () =>
                    import ('@/views/dataScreening/dataScreening'),
                meta: {
                    title: '数据总览'
                }
            },
            {
                path: '/weeklyReport',
                component: () =>
                    import ('@/views/weeklyReport/weeklyReport'),
                meta: {
                    title: '创作周报'
                }
            },
            {
                path: '/detailReport',
                component: () =>
                    import ('@/views/detailReport/detailReport'),
                meta: {
                    title: '创作者周报'
                }
            },
            {
                path: '/workData',
                component: () =>
                    import ('@/views/workData/workData'),
                meta: {
                    title: '作品数据'
                }
            }
        ]
    },
    {
        path: '/pay',
        component: () =>
            import ('@/views/Pay/pay'),
        meta: {
            title: '支付详情'
        }
    },
    // {
    //     path: '/',
    //     component: () =>
    //         import ('@/views/Login/login'),
    //     meta: {
    //         title: '登录页面'
    //     }
    // }
]

const router = new VueRouter({
    routes
})

export default router